package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zr.service.JscxServiceljc;
import com.zr.serviceImpl.JscxServiceImplljc;

import net.sf.json.JSONObject;
/**
 * 教师查询控制器
 * @author taylor
 *
 */
public class JscxControllerljc extends HttpServlet{
	
	JscxServiceljc jscxs = new JscxServiceImplljc();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf8");
		resp.setCharacterEncoding("utf8");
		//获取请求的page和rows
		int page = Integer.parseInt(req.getParameter("page"));
		int rows = Integer.parseInt(req.getParameter("rows"));
		//查找教师
		JSONObject j = jscxs.findAllTeacherByPageAndRows(page, rows);
		PrintWriter pw = resp.getWriter();
		pw.write(j.toString());
	}
}
